package package06章_面向对象编程_基础._03oop.exer1;

/**
 * ClassName: EmployeeTest
 * Package: package06章_面向对象编程_基础.oop3.exer1
 * Description:
 *案例：
 *
 * 声明员工类Employee，包含属性：编号id、姓名name、年龄age、薪资salary。
 *
 * 声明EmployeeTest测试类，并在main方法中，创建2个员工对象，并为属性赋值，并打印两个员工的信息。
 * @Author lys
 * @Create 2024/1/22 23:26
 * @Version 1.0
 */
public class EmployeeTest {
    public static void main(String[] args) {
        //创建类的实例（或创建类的对象、类的实例化）
        Employee emp1 = new Employee();

        System.out.println(emp1);//类型@地址值

        emp1.id = 1001;
        emp1.name = "Tom";
        emp1.age = 24;
        emp1.salary = 7800;

        System.out.println("id = " + emp1.id + ",name = " + emp1.name +
                ", age = " + emp1.age + ", salary = " + emp1.salary);

        //创建Employee的第2个对象
//        Employee emp3 = emp1;//错误写法
        Employee emp2 = new Employee();



        System.out.println("id = " + emp2.id + ",name = " + emp2.name +
                ", age = " + emp2.age + ", salary = " + emp2.salary);



    }
}
